package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品Id查询套餐id
     * @return
     */
    List<Long> getSetmealIdByDishId(List<Long> dishIds);

    /**
     * 根据套餐Id更新数据
     * @param setmealDishes
     */
    /*@Insert("insert into setmeal_dish(setmeal_id, dish_id, name, price, copies) " +
            "values (#{setmealId},#{dishId},#{name},#{price},#{copies})")*/
    void insert(List<SetmealDish> setmealDishes );

    /**
     * 删除套餐菜品表中的数据
     * @param ids
     */
    void deleteBySetmealId(List<Long> ids);

    /**
     * 根据套餐id查询菜品数据
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);
}
